<%-- 
    Document   : editpage
    Created on : Nov 16, 2013, 12:08:34 PM
    Author     : Liem
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="/struts-tags" prefix="s"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x"%>
<jsp:include page="header.jsp"/>
<jsp:include page="leftbar.jsp"/>
<c:if test="${not empty sessionScope.USER}">
    <c:if test="${empty param.pageId} ">
        <jsp:forward page="error.jsp?error='Page does not exist'" />
    </c:if>
    <c:set var="pageId" value="${param.pageId}"/>
    <c:set var="username" value="${sessionScope.USER}"/>
    <div class="main-wrapper">
        <div class="container-fluid">
            <div class="row-fluid">
                <div class="span12">
                    <div class="primary-head">
                        <h3 class="page-header">Edit Page's Info</h3>
                    </div>
                </div>
            </div>
            <div class="row-fluid" style="padding-bottom: 20px">
                <div class="span12">
                    <div class="profile-info">
                        <c:url value="/sendConfession.jsp" var="url">
                            <c:param name="pageId" value="${pageId}"/>"
                        </c:url>
                        <c:import url="WEB-INF/xml/page.xml" var="xml" charEncoding="UTF-8"/>
                        <c:import url="WEB-INF/xsl/editPage.xsl" var="xsl" charEncoding="UTF-8"/>
                        <x:transform xml="${xml}" xslt="${xsl}">
                            <x:param name="pageId" value="${pageId}"/>
                            <x:param name="webPath" value="${url}"/>
                        </x:transform>
                        <c:import url="WEB-INF/xml/userpage.xml" var="userpage" charEncoding="UTF-8"/>
                        <c:import url="WEB-INF/xsl/inactivePage.xsl" var="inactive" charEncoding="UTF-8"/>
                        <x:transform xml="${userpage}" xslt="${inactive}">
                            <x:param name="username" value="${username}"/>
                            <x:param name="pageId" value="${pageId}"/>
                        </x:transform>
                    </div>
                </div>
            </div>
                    <c:import url="WEB-INF/xsl/listManager.xsl" var="manager" charEncoding="UTF-8"/>
                    <x:transform xml="${userpage}" xslt="${manager}">
                        <x:param name="pageId" value="${pageId}"/>
                        <x:param name="username" value="${username}"/>
                    </x:transform>
        </div>
    </div>
</c:if>

<script type="text/javascript">

    var sendConfUrl = window.location.protocol + "//" + window.location.host + "/MyConfession/sendConfession.jsp?pageId=${pageId}";
    var aLink = document.getElementById("confUrl");
    aLink.innerHTML = sendConfUrl;
</script>
<c:if test="${empty sessionScope.USER}">
    <jsp:forward page="login.jsp"/>
</c:if>
<jsp:include page="footer.jsp"/>
